package com.neusoft.yuejian12.yuejian_12.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.MediaController;

import com.neusoft.yuejian12.yuejian_12.R;
import com.neusoft.yuejian12.yuejian_12.adapter.ClubVideoAdapter;
import com.neusoft.yuejian12.yuejian_12.javabean.VideoBean;
import com.neusoft.yuejian12.yuejian_12.listener.RetrofitListener;
import com.neusoft.yuejian12.yuejian_12.model.ClubModel;

import java.util.List;


public class ClubVideoActivity extends Activity implements View.OnClickListener,RetrofitListener<List<VideoBean>> {
    private ImageView left;
    private RecyclerView recyclerView;
    private ClubVideoAdapter adapter;
    private MediaController mediaController;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_club_video);
        initView();
        initEvent();
        getClubvideolist();

    }

    private void initView() {
        recyclerView = (RecyclerView) findViewById(R.id.club_video);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));//设置布局
        left = (ImageView) findViewById(R.id.left);

    }

    private void initEvent() {
        //返回上一页
        left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();}
        });

    }
    void getClubvideolist(){
        Bundle bundle = this.getIntent().getExtras();
        int c_id = bundle.getInt("c_id");
        ClubModel clubModel=new ClubModel();
        clubModel.getClubvideolist(c_id,this);
    }

    @Override
    public void onSuccess(List<VideoBean> videoBeen){
        adapter = new ClubVideoAdapter(ClubVideoActivity.this,videoBeen);
        recyclerView.setAdapter(adapter);
    }

    @Override
    public void onFail() {
        //showToast("网络发生错误");
    }
    @Override
    public void onClick(View view) {

    }
}
